﻿#pragma once

#include <QObject>
#include "../SystemJournal/systemjournal.h"
#include "component_data.h"

#define systemState (SystemState::GetInstance())

class SystemStateBase;
class SystemState : public QObject
{
	Q_OBJECT

public:
	SystemState(QObject *parent);
	~SystemState();

	static SystemState* GetInstance();
	bool Init();
	void SystemStart();
	void Run();
	void Stop();

	QString GetCurrentStateStr();
	SystemStateType GetCurrentState();

private slots:
	void OnChangeSystemState(int state);

signals:
	void PublishSystemState(int state);
	//void ShowDialog(int type);

private:
	bool SystemReset();
	bool SystemCheck();
private:
	SystemJournal m_writer;
	SystemStateType m_currentState = SystemStateType::system_state_idle;
	SystemStateBase* m_idle = nullptr;
	SystemStateBase* m_work = nullptr;
	SystemStateBase* m_stop = nullptr;
};
